<template>
	<view class="banquet-info">
		<view class="c-row-box">
			<view class="c-row-head"><view class="c-row-title">结算信息</view></view>
			<view class="c-row-item">
				<view class="c-row c-row-list" v-if="orderParams.order_nature == 2 && !include(orderParams.news_type, ['1', '8', '10', '9', '6', '4'])">
					<view class="c-row-col c-row-col-list-item">
						<view class="col-title">
							<text style="color: red;">*</text>
							桌数
						</view>
						<view class="col-text"><input type="digit" v-model="settleParams.table_amount" @input="settleChange" :disabled="isPreview" placeholder="请输入" /></view>
					</view>
				</view>
				<view class="c-row c-row-list" v-if="orderParams.order_nature == 2 && !include(orderParams.news_type, [1, 8, 10, 9, 6, 4])">
					<view class="c-row-col c-row-col-list-item">
						<view class="col-title">
							<text style="color: red;">*</text>
							餐标
						</view>
						<view class="col-text"><input type="digit" v-model="settleParams.table_price" @input="settleChange" :disabled="isPreview" placeholder="请输入" /></view>
					</view>
				</view>
				<view class="c-row c-row-list">
					<view class="c-row-col c-row-col-list-item">
						<view class="col-title">
							<text style="color: red;">*</text>
							结算总价
						</view>
						<view class="col-text"><input type="digit" v-model="settleParams.settle_totals" :disabled="isPreview" placeholder="请输入" /></view>
					</view>
				</view>
				<view class="c-row c-row-list">
					<view class="c-row-col c-row-col-list-item">
						<view class="col-title">
							<text style="color: red;">*</text>
							结算比例
						</view>
						<view class="col-text"><input type="digit" v-model="settleParams.settle_percent" :disabled="isPreview" placeholder="按百分比" /></view>
						<text style="font-size: 12px;">%</text>
					</view>
				</view>
				<view class="c-row c-row-list">
					<view class="c-row-col c-row-col-list-item">
						<view class="col-title">
							<text style="color: red;">*</text>
							结算时间
						</view>
						<view class="col-text">
							<picker mode="date" :start="startDate" :end="endDate" @change="settleDateChange" :disabled="isPreview">
								<view>{{ settleParams.settle_time }}</view>
							</picker>
						</view>
					</view>
				</view>
				<view class="c-row c-row-list">
					<view class="c-row-col c-row-col-list-item">
						<view class="col-title">
							<text style="color: red;">*</text>
							应收结算
						</view>
						<view class="col-text"><input type="digit" v-model="settleParams.settle_real_total" :disabled="isPreview" placeholder="请输入" /></view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { include } from '@/utils/common.js';
export default {
	props: {
		parent: {
			type: Object,
			default() {
				return {};
			}
		},
		isPreview: {
			type: Boolean,
			default() {
				return false;
			}
		},
		settleParams: {
			type: Object,
			default() {
				return {};
			}
		},
		startDate: {
			type: String,
			default() {
				return '';
			}
		},
		endDate: {
			type: String,
			default() {
				return '';
			}
		},
		orderParams: {
			type: Object,
			default() {
				return {};
			}
		},
		orderNature: {
			type: Array,
			default() {
				return [];
			}
		}
	},
	data() {
		return {};
	},
	beforeMount() {
		this.include = include;
	},
	onLoad(msg) {
	},
	mounted() {
	},
	methods: {
		// 婚宴信息发生变化
		settleChange() {
			let that = this;
			that.settleParams.settle_totals = (
				parseFloat(that.settleParams.table_amount === '' ? 0 : that.settleParams.table_amount) *
				parseFloat(that.settleParams.table_price === '' ? 0 : that.settleParams.table_price)
			).toFixed(2);
			that.parent.getOrderTotals();
		},

		// 结算时间
		settleDateChange(e) {
			this.settleParams.settle_time = e.target.value;
		}
	}
};
</script>

<style lang="less">
@import url('../../components/common.less');
@import url('./common.less');
</style>
